package Epic;

import java.util.Scanner;


/**
 * Write algorithm to return change in denominations of 10$, 5$, 1$, 25 cents, 10 cents
 * @author Ray
 *
 */
public class Coin_Change {
	
	public static void change(double cost, double cash){
		if(cash<cost)
			System.out.println("Not enough money");
		if(cost==cash)
			System.out.println("No need to change");
		double[] coin = {10,5,1,0.25,0.1,0.05,0.01};
		double change = cash-cost;
		for(int i=0;i<coin.length;++i){
			double remain = (double)((double)change%coin[i]);
			int num = (int) ((change-remain)/coin[i]);
			if(num>0){
				System.out.println("Number of "+coin[i]+"s is "+num);
				change = (double)(change-num*coin[i]);
			}
		}
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		System.out.println("Enter the cost");		
		double cost = Double.valueOf(in.nextLine());
		
		System.out.println("Enter the cash");
		double cash = Double.valueOf(in.nextLine());
		change(cost, cash);
	}

}
